package cn.ming.wfchat.app.me.activity;

import android.widget.TextView;

import butterknife.BindView;
import butterknife.OnClick;
import cn.ming.wfchat.R;
import cn.ming.wfchat.app.AppService;
import cn.ming.wfchat.app.dialog.VersionUpgradeDialog;
import cn.ming.wfchat.app.me.activity.model.VersionBean;
import cn.ming.wfchat.kit.WfcBaseActivity;
import cn.ming.wfchat.kit.utils.Tools;
import cn.wildfirechat.remote.ChatManager;

/**
 * @author luoming
 * created at 2020/8/11 3:04 PM
 * 关于我们
 */
public class AutoActivity extends WfcBaseActivity {


    @BindView(R.id.tv_version)
    TextView tvVersion;
    @BindView(R.id.tv_check)
    TextView tvCheck;
    @BindView(R.id.tv_text)
    TextView tvText;

    @Override

    protected int contentLayout() {
        return R.layout.auto_activity;
    }

    @Override
    protected void afterViews() {
        super.afterViews();
        setTitle("关于我们");
        initView();
    }

    void initView() {
        tvVersion.setText("版本： v" + Tools.getVersionName(AutoActivity.this));
        tvText.setText("Copyright ©️2020 " + getResources().getText(R.string.app_name) + ". All Rights Reserved.");
    }

    @OnClick(R.id.tv_check)
    void checkVersion() {
        AppService.Instance().checkVersion(new AppService.ChackVersionCallback() {
            @Override
            public void onUiSuccess(VersionBean assetsBean) {
                VersionUpgradeDialog.newInstance(assetsBean).show(AutoActivity.this);
            }

            @Override
            public void onUiFailure(int code, String msg) {
                ChatManager.showToast(msg);

            }
        });
    }
}
